package com.yi;

import org.apache.commons.collections.Transformer;

import java.io.Serializable;

//ChainedTransformer类主要代码
public class ChainedTransformer implements Transformer, Serializable {

    /**
     * The transformers to call in turn
     */
    private final Transformer[] iTransformers;

    //构造函数
    public ChainedTransformer(Transformer[] transformers) {
        super();
        iTransformers = transformers;
    }

    //transform函数
    public Object transform(Object object) {
        for (int i = 0; i < iTransformers.length; i++) {
            object = iTransformers[i].transform(object);
        }
        return object;
    }

}